Aims: To calculate chemistry and gas temperature of evolving protoplanetary disks with decreasing mass or dust settling, and to explore the sensitivity of gas-phase tracers. Methods: The density and dust temperature profiles for a range of models of flaring and self-shadowed disks around a typical Herbig Ae star are used together with 2-dimensional ultraviolet (UV) radiative transfer to calculate the chemistry and gas temperature. In each model the line profiles and intensities for the fine structure lines of [O I], [C II] and [C I] and the pure rotational lines of CO, CN, HCN and HCO+ are determined. Results: The chemistry shows a strong correlation with disk mass. Molecules that are easily dissociated, like HCN, require high densities and large extinctions before they can become abundant. The products of photodissociation, like CN and C2H, become abundant in models with lower masses. Dust settling mainly affects the gas temperature, and thus high temperature tracers like the O and C+ fine structure lines. The carbon chemistry is found to be very sensitive to the adopted PAH abundance. The line ratios CO/13CO, CO/HCO+ and [O I] 63 um/146 um can be used to distinguish between disks where dust growth and settling takes place, and disks that undergo overall mass loss.